#tag Class
Class NSDictionary
Inherits NSObject
	#tag Method, Flags = &h21
		Private Shared Function ClassRef() As Ptr
		  
		  static ref as Ptr = Cocoa.NSClassFromString("NSDictionary")
		  return ref
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Sub Constructor(file as FolderItem)
		  
		  #if targetMacOS
		    declare function initWithContentsOfFile lib CocoaLib selector "initWithContentsOfFile:" (obj_id as Ptr, path as CFStringRef) as Ptr
		    
		    super.Constructor(initWithContentsOfFile(Allocate("NSDictionary"), file.POSIXPath), NSDictionary.hasOwnership)
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1000
		Sub Constructor(otherDictionary as NSDictionary)
		  
		  #if targetMacOS
		    declare function initWithDictionary lib CocoaLib selector "initWithDictionary:" (obj_id as Ptr, otherDictionary as Ptr) as Ptr
		    
		    super.Constructor(initWithDictionary(Allocate("NSDictionary"), otherDictionary), NSDictionary.hasOwnership)
		    
		  #else
		    #pragma unused otherDictionary
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1000
		Sub Constructor(otherDictionary as NSDictionary, copyItems as Boolean)
		  
		  #if targetMacOS
		    declare function initWithDictionary lib CocoaLib selector "initWithDictionary:copyItems:" (obj_id as Ptr, otherDictionary as Ptr, flag as Boolean) as Ptr
		    
		    super.Constructor(initWithDictionary(Allocate("NSDictionary"), otherDictionary, copyItems), NSDictionary.hasOwnership)
		    
		  #else
		    #pragma unused otherDictionary
		    #pragma unused copyItems
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1000
		Sub Constructor(keys() as NSObject, objects() as NSObject)
		  
		  #if targetMacOS
		    declare function initWithObjects lib CocoaLib selector "initWithObjects:forKeys:" (obj_id as Ptr, objects as Ptr, keys as Ptr) as Ptr
		    
		    dim keysArray as new NSArray(keys)
		    dim objectsArray as new NSArray(objects)
		    
		    super.Constructor(initWithObjects(Allocate("NSDictionary"), objectsArray, keysArray), NSDictionary.hasOwnership)
		    
		  #else
		    #pragma unused keys
		    #pragma unused objects
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1000
		Sub Constructor(aURL as NSURL)
		  
		  #if targetMacOS
		    declare function initWithContentsOfURL lib CocoaLib selector "initWithContentsOfURL:" (obj_id as Ptr, aURL as Ptr) as Ptr
		    
		    super.Constructor(initWithContentsOfURL(Allocate("NSDictionary"), aURL), NSDictionary.hasOwnership)
		    
		  #else
		    #pragma unused aURL
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Copy() As NSDictionary
		  
		  #if TargetMacOS
		    declare function copy_ lib CocoaLib selector "copy" (obj_id as Ptr) as Ptr
		    
		    dim dictRef as Ptr = copy_(self)
		    if dictRef <> nil then
		      return new NSDictionary(dictRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Count() As UInt32
		  
		  #if targetMacOS
		    declare function count lib CocoaLib selector "count" (obj_id as Ptr) as UInt32
		    
		    return count(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		 Shared Function Create() As NSDictionary
		  
		  #if TargetMacOS
		    declare function dictionary_ lib CocoaLib selector "dictionary" (class_id as Ptr) as Ptr
		    
		    dim dictRef as Ptr = dictionary_(ClassRef)
		    if dictRef <> nil then
		      return new NSDictionary(dictRef)
		    else
		      return nil
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		 Shared Function CreateFromRSDictionary(dict as Dictionary) As NSDictionary
		  #if TargetMacOS
		    dim md as NSMutableDictionary = NSMutableDictionary.Create
		    
		    for i as integer=0 to dict.Count - 1
		      md.Value( Cocoa.NSObjectFromRSVariant( dict.Key( i ))) = Cocoa.NSObjectFromRSVariant( dict.value( dict.key( i )))
		    next
		    
		    return   md.Copy
		    
		  #endif
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		 Shared Function CreateWithDictionary(otherDictionary as NSDictionary) As NSDictionary
		  
		  #if TargetMacOS
		    declare function dictionaryWithDictionary lib CocoaLib selector "dictionaryWithDictionary:" _
		    (class_id as Ptr, otherDictionary as Ptr) as Ptr
		    
		    if otherDictionary <> nil then
		      dim dictRef as Ptr = dictionaryWithDictionary(ClassRef, otherDictionary)
		      if dictRef <> nil then
		        return new NSDictionary(dictRef)
		      end if
		    end if
		    
		  #else
		    #pragma unused otherDictionary
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		 Shared Function CreateWithFile(file as FolderItem) As NSDictionary
		  
		  #if TargetMacOS
		    declare function dictionaryWithContentsOfFile lib CocoaLib selector "dictionaryWithContentsOfFile:" _
		    (class_id as Ptr, path as CFStringRef) as Ptr
		    
		    if file <> nil then
		      dim dictRef as Ptr = dictionaryWithContentsOfFile(ClassRef, file.POSIXPath)
		      if dictRef <> nil then
		        return new NSDictionary(dictRef)
		      end if
		    end if
		    
		  #else
		    #pragma unused file
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		 Shared Function CreateWithObject(key as Ptr, anObject as Ptr) As NSDictionary
		  
		  #if TargetMacOS
		    declare function dictionaryWithObject lib CocoaLib selector "dictionaryWithObject:forKey:" _
		    (class_id as Ptr, anObject as Ptr, key as Ptr) as Ptr
		    
		    dim dictRef as Ptr = dictionaryWithObject(ClassRef, anObject, key)
		    if dictRef <> nil then
		      return new NSDictionary(dictRef)
		    end if
		    
		  #else
		    #pragma unused key
		    #pragma unused anObject
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		 Shared Function CreateWithObjects(keys() as NSObject, objects() as NSObject) As NSDictionary
		  
		  #if TargetMacOS
		    declare function dictionaryWithObjects lib CocoaLib selector "dictionaryWithObjects:forKeys:" _
		    (class_id as Ptr, objects as Ptr, keys as Ptr) as Ptr
		    
		    dim keysArray as new NSArray(keys)
		    dim objectsArray as new NSArray(objects)
		    
		    dim dictRef as Ptr = dictionaryWithObjects(ClassRef, objectsArray, keysArray)
		    if dictRef <> nil then
		      return new NSDictionary(dictRef)
		    end if
		    
		  #else
		    #pragma unused keys
		    #pragma unused objects
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		 Shared Function CreateWithURL(aURL as NSURL) As NSDictionary
		  
		  #if TargetMacOS
		    declare function dictionaryWithContentsOfURL lib CocoaLib selector "dictionaryWithContentsOfURL:" _
		    (class_id as Ptr, aURL as Ptr) as Ptr
		    
		    if aURL <> nil then
		      dim dictRef as Ptr = dictionaryWithContentsOfURL(ClassRef, aURL)
		      if dictRef <> nil then
		        return new NSDictionary(dictRef)
		      end if
		    end if
		    
		  #else
		    #pragma unused aURL
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileCreationDate() As NSDate
		  
		  #if targetMacOS
		    declare function fileCreationDate lib CocoaLib selector "fileCreationDate" (obj_id as Ptr) as Ptr
		    
		    dim dateRef as Ptr = fileCreationDate(self)
		    if dateRef <> nil then
		      return new NSDate(dateRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileExtensionHidden() As Boolean
		  
		  #if targetMacOS
		    declare function fileExtensionHidden lib CocoaLib selector "fileExtensionHidden" (obj_id as Ptr) as Boolean
		    
		    return fileExtensionHidden(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileGroupOwnerAccountID() As NSNumber
		  
		  #if targetMacOS
		    declare function fileGroupOwnerAccountID lib CocoaLib selector "fileGroupOwnerAccountID" (obj_id as Ptr) as Ptr
		    
		    dim numberRef as Ptr = fileGroupOwnerAccountID(self)
		    if numberRef <> nil then
		      return new NSNumber(numberRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileGroupOwnerAccountName() As String
		  
		  #if targetMacOS
		    declare function fileGroupOwnerAccountName lib CocoaLib selector "fileGroupOwnerAccountName" (obj_id as Ptr) as CFStringRef
		    
		    return fileGroupOwnerAccountName(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileHFSCreatorCode() As OSType
		  
		  #if targetMacOS
		    declare function fileHFSCreatorCode lib CocoaLib selector "fileHFSCreatorCode" (obj_id as Ptr) as OSType
		    
		    return fileHFSCreatorCode(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileHFSTypeCode() As OSType
		  
		  #if targetMacOS
		    declare function fileHFSTypeCode lib CocoaLib selector "fileHFSTypeCode" (obj_id as Ptr) as OSType
		    
		    return fileHFSTypeCode(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileIsAppendOnly() As Boolean
		  
		  #if targetMacOS
		    declare function fileIsAppendOnly lib CocoaLib selector "fileIsAppendOnly" (obj_id as Ptr) as Boolean
		    
		    return fileIsAppendOnly(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileIsImmutable() As Boolean
		  
		  #if targetMacOS
		    declare function fileIsImmutable lib CocoaLib selector "fileIsImmutable" (obj_id as Ptr) as Boolean
		    
		    return fileIsImmutable(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileModificationDate() As NSDate
		  
		  #if targetMacOS
		    declare function fileModificationDate lib CocoaLib selector "fileModificationDate" (obj_id as Ptr) as Ptr
		    
		    dim dateRef as Ptr = fileModificationDate(self)
		    if dateRef <> nil then
		      return new NSDate(dateRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileOwnerAccountID() As NSNumber
		  
		  #if targetMacOS
		    declare function fileOwnerAccountID lib CocoaLib selector "fileOwnerAccountID" (obj_id as Ptr) as Ptr
		    
		    dim numberRef as Ptr = fileOwnerAccountID(self)
		    if numberRef <> nil then
		      return new NSNumber(numberRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileOwnerAccountName() As String
		  
		  #if targetMacOS
		    declare function fileOwnerAccountName lib CocoaLib selector "fileOwnerAccountName" (obj_id as Ptr) as CFStringRef
		    
		    return fileOwnerAccountName(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FilePosixPermissions() As UInt32
		  
		  #if targetMacOS
		    declare function fileOwnerAccountName lib CocoaLib selector "fileOwnerAccountName" (obj_id as Ptr) as UInt32
		    
		    return fileOwnerAccountName(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileSize() As UInt64
		  
		  #if targetMacOS
		    declare function fileSize lib CocoaLib selector "fileSize" (obj_id as Ptr) as UInt64
		    
		    return fileSize(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileSystemFileNumber() As UInt32
		  
		  #if targetMacOS
		    declare function fileSystemFileNumber lib CocoaLib selector "fileSystemFileNumber" (obj_id as Ptr) as UInt32
		    
		    return fileSystemFileNumber(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileSystemNumber() As Integer
		  
		  #if targetMacOS
		    declare function fileSystemNumber lib CocoaLib selector "fileSystemNumber" (obj_id as Ptr) as Integer
		    
		    return fileSystemNumber(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function FileType() As String
		  
		  #if targetMacOS
		    declare function fileType lib CocoaLib selector "fileType" (obj_id as Ptr) as CFStringRef
		    
		    return fileType(self)
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function IsEqual(otherDictionary as NSDictionary) As Boolean
		  
		  #if targetMacOS
		    declare function isEqualToDictionary lib CocoaLib selector "isEqualToDictionary:" (obj_id as Ptr, otherDictionary as Ptr) as Boolean
		    
		    dim otherDictRef as Ptr
		    if otherDictionary <> nil then
		      otherDictRef = otherDictionary
		    end if
		    
		    return isEqualToDictionary(self, otherDictRef)
		    
		  #else
		    #pragma unused otherDictionary
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function KeyEnumerator() As NSEnumerator
		  
		  #if targetMacOS
		    declare function keyEnumerator lib CocoaLib selector "keyEnumerator" (obj_id as Ptr) as Ptr
		    
		    dim enumRef as Ptr = keyEnumerator(self)
		    if enumRef <> nil then
		      return new NSEnumerator(enumRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Keys() As NSArray
		  
		  #if targetMacOS
		    declare function allKeys lib CocoaLib selector "allKeys" (obj_id as Ptr) as Ptr
		    
		    dim arrayRef as Ptr = allKeys(self)
		    if arrayRef <> nil then
		      return new NSArray(arrayRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Keys(anObject as Ptr) As NSArray
		  
		  #if targetMacOS
		    declare function allKeysForObject lib CocoaLib selector "allKeysForObject:" (obj_id as Ptr, anObject as Ptr) as Ptr
		    
		    dim arrayRef as Ptr = allKeysForObject(self, anObject)
		    if arrayRef <> nil then
		      return new NSArray(arrayRef)
		    end if
		    
		  #else
		    #pragma unused anObject
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Lookup(key as Ptr, fallbackValue as Ptr) As Ptr
		  
		  dim lookupValue as Ptr = self.Value(key)
		  
		  if lookupValue <> nil then
		    return lookupValue
		  else
		    return fallbackValue
		  end if
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Lookup(key as String, fallbackValue as Ptr) As Ptr
		  
		  dim lookupValue as Ptr = self.Value(key)
		  
		  if lookupValue <> nil then
		    return lookupValue
		  else
		    return fallbackValue
		  end if
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function Operator_Convert() As Dictionary
		  
		  return self.VariantValue
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Value(key as Ptr) As Ptr
		  
		  #if targetMacOS
		    declare function objectForKey lib CocoaLib selector "objectForKey:" (obj_id as Ptr, key as Ptr) as Ptr
		    
		    return objectForKey(self, key)
		    
		  #else
		    #pragma unused key
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Value(key as String) As Ptr
		  
		  #if targetMacOS
		    declare function valueForKey lib CocoaLib selector "valueForKey:" (obj_id as Ptr, key as CFStringRef) as Ptr
		    
		    return valueForKey(self, key)
		    
		  #else
		    #pragma unused key
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function ValueEnumerator() As NSEnumerator
		  
		  #if targetMacOS
		    declare function objectEnumerator lib CocoaLib selector "objectEnumerator" (obj_id as Ptr) as Ptr
		    
		    dim enumRef as Ptr = objectEnumerator(self)
		    if enumRef <> nil then
		      return new NSEnumerator(enumRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Values() As NSArray
		  
		  #if targetMacOS
		    declare function allValues lib CocoaLib selector "allValues" (obj_id as Ptr) as Ptr
		    
		    dim arrayRef as Ptr = allValues(self)
		    if arrayRef <> nil then
		      return new NSArray(arrayRef)
		    end if
		    
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h0
		Function VariantValue() As Variant
		  
		  dim returnDict as new Dictionary
		  dim e as NSEnumerator = self.KeyEnumerator
		  
		  dim key as Ptr = e.NextObject
		  while key <> nil
		    dim keyVariant as Variant = VariantValueInterface(Cocoa.NSObjectFromNSPtr(key)).VariantValue
		    dim valueVariant as Variant = VariantValueInterface(Cocoa.NSObjectFromNSPtr(self.Value(key))).VariantValue
		    returnDict.value(keyVariant) = valueVariant
		    key = e.NextObject
		  wend
		  
		  return returnDict
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Write(file as FolderItem, atomically as Boolean) As Boolean
		  
		  #if targetMacOS
		    declare function writeToFile lib CocoaLib selector "writeToFile:atomically:" (obj_id as Ptr, path as CFStringRef, flag as Boolean) as Boolean
		    
		    if file <> nil then
		      return writeToFile(self, file.POSIXPath, atomically)
		    else
		      return false
		    end if
		    
		  #else
		    #pragma unused file
		    #pragma unused atomically
		  #endif
		  
		End Function
	#tag EndMethod

	#tag Method, Flags = &h1000
		Function Write(aURL as NSURL, atomically as Boolean) As Boolean
		  
		  #if targetMacOS
		    declare function writeToURL lib CocoaLib selector "writeToURL:atomically:" (obj_id as Ptr, aURL as Ptr, flag as Boolean) as Boolean
		    
		    dim urlRef as Ptr
		    if urlRef <> nil then
		      urlRef = aURL
		    end if
		    
		    return writeToURL(self, urlRef, atomically)
		    
		  #else
		    #pragma unused aURL
		    #pragma unused atomically
		  #endif
		  
		End Function
	#tag EndMethod


	#tag ViewBehavior
		#tag ViewProperty
			Name="Description"
			Group="Behavior"
			Type="String"
			EditorType="MultiLineEditor"
			InheritedFrom="NSObject"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Class
#tag EndClass
